package main

import (
	"fmt"
	"math"
)

func main() {
	func (data int){
		fmt.Println("Hello Go")
	}(100)

	result := func (data float64) float64{
		return math.Sqrt(data)
	}(250)
	fmt.Println(result)

	myFunc := func(data string) string{
		return data
	}
	fmt.Println(myFunc("欢迎学习Go"))

	arr:= []float64{1,9,16,25,36,64}
	res :=FilterSlice(arr, func(f float64) string {
		f = math.Sqrt(f)
		return fmt.Sprintf("%.2f",f)
	})
	fmt.Println(res)
}

type myFuncs func(float64)string

func FilterSlice(arr []float64,f myFuncs) []string{
	var result []string
	for _,value := range arr  {
		result = append(result,f(value))
	}
	return result
}